audio: pcm_converter: change pcm conversion functions interface - #11052
audio: pcm_converter: change pcm conversion functions interface#11052softwarecki wants to merge 2 commits into
Conversation
Qualify the source pointer of circular buffer as const in cir_buf_copy() and cir_buf_bytes_without_wrap() functions. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
There was a problem hiding this comment.
🟡 Not ready to approve
There are correctness/robustness issues in the updated PCM converter and const-handling that should be addressed before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR updates the PCM conversion and DMA copy integration to use circular-buffer source/sink descriptors (cir_buf_source / cir_buf_sink) instead of legacy audio_stream buffers, aligning the data-path interfaces with the pipeline 2.0 transition.
Changes:
- Reworked
pcm_converter_func/dma_process_funcsignatures to consume circular-buffer descriptors plus explicit channel counts. - Updated DMA copy paths and copier module bridging code to construct and pass circular-buffer descriptors into converters.
- Refactored “just copy” conversions into size-specific implementations (
just_copy_{1b,2b,3b,4b}) based on sample size.
File summaries
| File | Description |
|---|---|
| zephyr/include/sof/lib/dma.h | Updates dma_process_func typedef to circular-buffer descriptors and channel-count parameters. |
| posix/include/sof/lib/dma.h | Mirrors the dma_process_func signature update for the POSIX build. |
| src/lib/dma.c | Bridges DMA buffer-copy flows to the new converter interface via cir_buf_source/cir_buf_sink. |
| src/include/sof/audio/pcm_converter.h | Updates converter public API to the new descriptor-based interface; introduces typed just_copy_* APIs. |
| src/include/sof/audio/audio_stream.h | Tightens const-correctness for circular-buffer helpers (cir_buf_bytes_without_wrap, cir_buf_copy). |
| src/audio/component.c | Adjusts cir_buf_copy() signature/implementation for const source pointers. |
| src/audio/pcm_converter/pcm_converter.c | Implements descriptor-based linear conversion and size-typed “just copy” helpers. |
| src/audio/pcm_converter/pcm_converter_hifi3.c | Adapts HiFi3 optimized converters to descriptor-based access and wrap helpers. |
| src/audio/pcm_converter/pcm_converter_generic.c | Adapts generic converters to descriptor-based access and wrap helpers. |
| src/audio/pcm_converter/pcm_remap.c | Reworks remap/mute helpers to operate on descriptor pointers and explicit channel counts. |
| src/audio/copier/copier.c | Bridges legacy copier buffers into circular-buffer descriptors before calling converters. |
| test/cmocka/src/audio/pcm_converter/pcm_float.c | Updates unit test invocation to pass circular-buffer descriptors and channel counts. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 3
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| const int log2_s_size_in = ffs(s_size_in) - 1; | ||
| const int log2_s_size_out = ffs(s_size_out) - 1; |
| static void just_copy_bytes(const struct cir_buf_source *source, struct cir_buf_sink *sink, | ||
| uint32_t bytes) |
| const ae_int16x8 *in = cir_buf_wrap(src, src_addr, src_end); | ||
| ae_int16x8 *out = (ae_int16x8 *)dst; |
There was a problem hiding this comment.
side note: I find cir_buf_wrap() a bad interface - it blatantly casts away the const qualifier of the argument. I think it should be fixed.
|
@softwarecki some build errors: |
Rework the pcm conversion and dma copy paths to operate on circular buffer source and sink descriptors instead of the legacy audio stream buffers. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Rework the pcm conversion and dma copy paths to operate on circular buffer source and sink descriptors instead of the legacy audio stream buffers to prepare the sof for the full transition to pipeline 2.0.